#include "StdAfx.h"
#include "TransMessage.h"
#include "FlowChartSystem.h"
#include "UnitManager.h"
#include "Service.h"

Message_Type	CTransMessage::s_currOpertionType;
TCHAR			CTransMessage::s_operationParam[TRANS_BUFFER_SIZE];
int				CTransMessage::s_dataSize;

CTransMessage::CTransMessage(void)
{
}

CTransMessage::~CTransMessage(void)
{
}

sDataPackage* CTransMessage::getServerServiceInfo()
{
	static	sDataPackage	s_data;
	s_data.msgType  = s_currOpertionType;
	s_data.dataSize = s_dataSize;
	memmove( s_data.pData, s_operationParam, s_dataSize );
	return &s_data;
}

void CTransMessage::setOperationType( Message_Type p_msgType, void* p_pParam, int p_paramLength )
{
	s_currOpertionType = p_msgType;
	s_dataSize		   = p_paramLength;
	memmove( s_operationParam, p_pParam, p_paramLength );
	CService::serviceOnDraw();
}

sDataPackage* CTransMessage::getWholeTree()
{
	static	sDataPackage	s_data;
	s_data.msgType = MSGT_CONNECT_SUCCESS;
	s_data.dataSize = CUnitManager::fillPackageWithTree(s_data.pData);
	return &s_data;
}